import { request } from "@/utils/request"

/** session列表 */
export function getSession() {
  return request({
    url: `/v1.0/session/list`,
    method: "get"
  })
}

/** 查询 */
export function findSession(type: string, val: string) {
  return request({
    url: `/v1.0/session/search?${type}=${val}`,
    method: "get"
  })
}

/** 增加session会话 */
export function createSession(data: any) {
  return request({
    url: "/v1.0/session/add",
    method: "post",
    data
  })
}

/** 修改session会话 */
export function updateSession(id: string, data: any) {
  return request({
    url: `/v1.0/session/update/${id}`,
    method: "put",
    data
  })
}

/** 删除session */
export function delSession(id: string) {
  return request({
    url: `/v1.0/session/del?id=${id}`,
    method: "delete"
  })
}

/** 聊天列表 */
export function getChat() {
  return request({
    url: `/v1.0/chatmessage/list`,
    method: "get"
  })
}

/** 查询聊天 */
export function findChat(val: string) {
  return request({
    url: `/v1.0/chatmessage/search?sessionId=${val}`,
    method: "get"
  })
}

/** 增加聊天 */
export function createChat(data: any) {
  return request({
    url: "/v1.0/chatmessage/add",
    method: "post",
    data
  })
}

/** 修改聊天 */
export function updateChat(id: string, data: any) {
  return request({
    url: `/v1.0/chatmessage/${id}`,
    method: "put",
    data
  })
}

/** 删除聊天 */
export function delChat(id: string) {
  return request({
    url: `/v1.0/chatmessage/del?id=${id}`,
    method: "delete"
  })
}
